package com.utils.toast.ext

import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import com.utils.R
import com.utils.toast.IToastView

/**
 * @describe:
 * @Author: lixiaopeng
 * @Date: 4/7/21
 */
class TextToastView : ConstraintLayout, IToastView {

    private val textView:TextView

    var text = ""

    constructor(context: Context) : this(context,null)
    constructor(context: Context, attrs: AttributeSet?) : super(context, attrs){
        val inflate = inflate(context, R.layout.common_toast, this)
        textView = inflate.findViewById(R.id.toastMsg)
    }

    override fun show() {
        textView.text = text
    }

    override fun getToastView(): View {
        return this
    }
}